<!DOCTYPE html>
<html lang="zh_Ch">
    <head>
  <!-- 元数据 -->
  <meta charset="utf-8">
  
  
  <title>js文件生成和解析 | Blog</title>
  
  <meta name="author" content="Sun Liusen" />
  <meta http-equiv="Cache-Control" content="no-transform" />
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="robots" content="index,follow" />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <meta name="format-detection" content="telphone=no, email=no" />
  
    <meta name="keywords" content="前端" />
  
  <meta name="description" content="创建实例TEXT_FILE_TOOLS 如 new TEXT_FILE_TOOLS()会返回三个参数通过Promise将encodeFile和decodeFile    参数 介绍 传参    encodeFile 加密后生成文件，并返回Blob类型数据 String   decodeFile 读取文件后解密并返回字符串内容 File   base64Tolls Base64加密工具 无   实例">
<meta property="og:type" content="article">
<meta property="og:title" content="js文件生成和解析">
<meta property="og:url" content="https://slsandxr.top/2023/02/07/js%E6%96%87%E4%BB%B6%E7%94%9F%E6%88%90%E5%92%8C%E8%A7%A3%E6%9E%90/index.html">
<meta property="og:site_name" content="Blog">
<meta property="og:description" content="创建实例TEXT_FILE_TOOLS 如 new TEXT_FILE_TOOLS()会返回三个参数通过Promise将encodeFile和decodeFile    参数 介绍 传参    encodeFile 加密后生成文件，并返回Blob类型数据 String   decodeFile 读取文件后解密并返回字符串内容 File   base64Tolls Base64加密工具 无   实例">
<meta property="og:locale" content="zh_CH">
<meta property="article:published_time" content="2023-02-07T10:03:15.000Z">
<meta property="article:modified_time" content="2024-12-16T11:07:04.239Z">
<meta property="article:author" content="Sun Liusen">
<meta property="article:tag" content="前端">
<meta name="twitter:card" content="summary">
  
  <!-- 站点验证相关 -->
  
    
    
    
  
  <!-- 样式表文件 -->
  <link rel="stylesheet" id="kratos-css" href="/css/kratosr.min.css" media="all"></script>
  
    <link rel="stylesheet" id="darkmode-css" href="/css/kr-color-dark.min.css" media="(prefers-color-scheme: dark)"></script>
    <script src="/js/kr-dark.min.js"></script>
  
  
    <link rel="stylesheet" id="highlight-css" href="/css/highlight/night-eighties.min.css" media="all"></script>
  
  <link rel="stylesheet" id="fontawe-css" href="/vendors/font-awesome@4.7.0/css/font-awesome.min.css" media="all"></script>
  <link rel="stylesheet" id="nprogress-css" href="/vendors/nprogress@0.2.0/nprogress.css" media="all"></script>
  
  
    <link rel="stylesheet" href="/vendors/aplayer@1.10.1/dist/APlayer.min.css"></script>
  
  
    <link rel="stylesheet" href="/vendors/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css"></script>
  
  <!-- 不得不预先加载的一些JS文件 -->
  <script src="/vendors/jquery@3.6.0/dist/jquery.min.js"></script>
  
    <script src="/vendors/qrcode_js@1.0.0/qrcode.min.js"></script>
  
  
  <style>
    
    
  </style>
  
<meta name="generator" content="Hexo 6.3.0"></head>


    <body class="custom-background">
        <div id="kratos-wrapper">
    <div id="kratos-page">
        <div id="kratos-header">
            <header id="kratos-desktop-topnav" class="kratos-topnav">
                <div class="container">
                    <div class="nav-header">
                        <nav id="kratos-menu-wrap">
                            <ul id="kratos-primary-menu" class="sf-menu">
                                
                                    
                                    
                                
                            </ul>
                        </nav>
                    </div>
                </div>
            </header>
            <header id="kratos-mobile-topnav" class="kratos-topnav">
                <div class="container">
                    <div class="color-logo"><a href="/">Blog</a></div>
                    <div class="nav-toggle">
                        <a class="kratos-nav-toggle js-kratos-nav-toggle">
                            <i></i>
                        </a>
                    </div>
                </div>
            </header>
        </div>
        <div class="kratos-start kratos-hero-2">
            <!-- <div class="kratos-overlay"></div> -->
            <div class="kratos-cover kratos-cover-2 text-center">
                <div class="desc desc2 animate-box">
                    <a href="/">
                        <h2>Blog</h2> <br />
                        <span></span>
                    </a>
                </div>
            </div>
        </div>

        <div id="kratos-blog-post">
            <div class="container">
                <div id="main" class="row">
                    

        

            <section class="col-md-8">

        

            <article itemscope itemtype="https://schema.org/Article">
    
    <link itemprop="mainEntityOfPage" href="https://slsandxr.top/2023/02/07/js%E6%96%87%E4%BB%B6%E7%94%9F%E6%88%90%E5%92%8C%E8%A7%A3%E6%9E%90/">
    <div class="kratos-hentry kratos-post-inner clearfix">
        <header class="kratos-entry-header">
            
                <h1 class="kratos-entry-title text-center" itemprop="name headline">js文件生成和解析</h1>
            
            
            <ul class="kratos-post-meta text-center">
                <li><time datetime="2023-02-07T10:03:15.000Z" itemprop="datePublished"><i class="fa fa-calendar"></i> 2023-02-07</time></li>
                <li itemprop="author" itemscope itemtype="https://schema.org/Person">
                    <i class="fa fa-user"></i> 作者 <span itemprop="name">Sun Liusen</span>
                </li>
                
                    <li>
                        <i class="fa fa-edit"></i> 
                        
                        
                            ~13.91K
                        
                        字
                    </li>
                
                
            </ul>
        </header>
        <div class="kratos-post-content">
            
            <div id="expire-alert" class="alert alert-warning hidden" role="alert">
                <div class="icon"><i class="fa fa-warning"></i></div>
                <div class="text"><p>本文最后编辑于 <time datetime="1734347224239"></time> 前，其中的内容可能需要更新。</p></div>
            </div>
            
            
            
            <hr />
            <div itemprop="articleBody"><p>创建实例<code>TEXT_FILE_TOOLS</code> 如 <code>new TEXT_FILE_TOOLS()</code><br>会返回<code>三</code>个参数<br>通过<code>Promise</code>将<code>encodeFile</code>和<code>decodeFile</code></p>
<table>
<thead>
<tr>
<th>参数</th>
<th>介绍</th>
<th>传参</th>
</tr>
</thead>
<tbody><tr>
<td>encodeFile</td>
<td>加密后生成文件，并返回Blob类型数据</td>
<td>String</td>
</tr>
<tr>
<td>decodeFile</td>
<td>读取文件后解密并返回字符串内容</td>
<td>File</td>
</tr>
<tr>
<td>base64Tolls</td>
<td>Base64加密工具</td>
<td>无</td>
</tr>
</tbody></table>
<h2 id="实例操作"><a href="#实例操作" class="headerlink" title="实例操作"></a>实例操作</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line">let tools = new TEXT_FILE_TOOLS();</span><br><span class="line">console.log(tools);</span><br><span class="line">let data = `sahgohflafsafhfoad[fjdsfnsadsa，测试一下数据内容，看看有什么啊.]`;</span><br><span class="line">let a = document.getElementById(&#x27;a&#x27;);</span><br><span class="line"></span><br><span class="line">async function RUN() &#123;//手动触发id为a的第一个元素</span><br><span class="line">	let file = await tools.encodeFile(data);</span><br><span class="line">	downFile(window.URL.createObjectURL(file))</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">async function change(e) &#123; //文件读取并解密</span><br><span class="line">	console.log(e.files[0]);</span><br><span class="line">	let res = await tools.decodeFile(e.files[0]);</span><br><span class="line">	console.log(&#x27;结束的内容：&#x27;, res)</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">function downFile(href) &#123;</span><br><span class="line">	const a = document.createElement(&#x27;a&#x27;); //创建a标签</span><br><span class="line">	a.setAttribute(&#x27;download&#x27;, Date.now()); // 名字</span><br><span class="line">	a.setAttribute(&#x27;href&#x27;, href); // href链接</span><br><span class="line">	a.click(); // 自执行点击事件</span><br><span class="line">	document.body.appendChild(a); //插入body里</span><br><span class="line">	document.body.removeChild(a); //从body删除</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="JS工具代码"><a href="#JS工具代码" class="headerlink" title="JS工具代码"></a>JS工具代码</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br><span class="line">283</span><br><span class="line">284</span><br><span class="line">285</span><br><span class="line">286</span><br><span class="line">287</span><br><span class="line">288</span><br><span class="line">289</span><br><span class="line">290</span><br><span class="line">291</span><br><span class="line">292</span><br><span class="line">293</span><br><span class="line">294</span><br><span class="line">295</span><br><span class="line">296</span><br><span class="line">297</span><br><span class="line">298</span><br><span class="line">299</span><br><span class="line">300</span><br><span class="line">301</span><br><span class="line">302</span><br><span class="line">303</span><br><span class="line">304</span><br><span class="line">305</span><br><span class="line">306</span><br><span class="line">307</span><br><span class="line">308</span><br><span class="line">309</span><br><span class="line">310</span><br><span class="line">311</span><br><span class="line">312</span><br><span class="line">313</span><br><span class="line">314</span><br><span class="line">315</span><br><span class="line">316</span><br><span class="line">317</span><br><span class="line">318</span><br><span class="line">319</span><br><span class="line">320</span><br><span class="line">321</span><br><span class="line">322</span><br><span class="line">323</span><br><span class="line">324</span><br><span class="line">325</span><br><span class="line">326</span><br><span class="line">327</span><br><span class="line">328</span><br><span class="line">329</span><br><span class="line">330</span><br><span class="line">331</span><br><span class="line">332</span><br><span class="line">333</span><br><span class="line">334</span><br><span class="line">335</span><br><span class="line">336</span><br><span class="line">337</span><br></pre></td><td class="code"><pre><span class="line">class TEXT_FILE_TOOLS &#123;</span><br><span class="line">	constructor(options) &#123;</span><br><span class="line">		this.version = &quot;1.0.0&quot;;</span><br><span class="line">		this.des = &quot;base64加密。文本加密生成文件（txt），解析解密自己生成的文件。&quot;;</span><br><span class="line">		this.log(`文本加密解密工具加载成功,版本：$&#123;this.version&#125;`);</span><br><span class="line">		return &#123;</span><br><span class="line">			encodeFile: this.encodeFile,</span><br><span class="line">			decodeFile: this.decodeFile,</span><br><span class="line">			base64Tolls: this.base64Tolls</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">	encodeFile(str) &#123; //加密的文本文件</span><br><span class="line">		let &#123;</span><br><span class="line">			encode</span><br><span class="line">		&#125; = this.base64Tolls();</span><br><span class="line">		return new Promise((resove, reject) =&gt; &#123;</span><br><span class="line">			if (typeof str != &#x27;string&#x27;) return reject(&quot;数据类型错误&quot;);</span><br><span class="line">			console.log(&#x27;查看this:&#x27;, this)</span><br><span class="line">			resove(new Blob([encode(data)], &#123;</span><br><span class="line">				type: &#x27;text/plain&#x27;</span><br><span class="line">			&#125;));</span><br><span class="line">		&#125;);</span><br><span class="line">	&#125;</span><br><span class="line">	decodeFile(file) &#123; //读取并解密文件</span><br><span class="line">		let &#123;</span><br><span class="line">			decode</span><br><span class="line">		&#125; = this.base64Tolls();</span><br><span class="line">		return new Promise((resove, reject) =&gt; &#123;</span><br><span class="line">			let reader = new FileReader();</span><br><span class="line">			reader.readAsText(file, &quot;UTF-8&quot;);</span><br><span class="line">			reader.onload = e =&gt; &#123;</span><br><span class="line">				console.log(&quot;读取的原内容：&quot;, e.target.result)</span><br><span class="line">				resove(decode(e.target.result))</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;)</span><br><span class="line">	&#125;</span><br><span class="line">	base64Tolls() &#123;</span><br><span class="line">		/**</span><br><span class="line">		 *  base64.ts</span><br><span class="line">		 *</span><br><span class="line">		 *  Licensed under the BSD 3-Clause License.</span><br><span class="line">		 *    http://opensource.org/licenses/BSD-3-Clause</span><br><span class="line">		 *</span><br><span class="line">		 *  References:</span><br><span class="line">		 *    http://en.wikipedia.org/wiki/Base64</span><br><span class="line">		 *</span><br><span class="line">		 * @author Dan Kogai (https://github.com/dankogai)</span><br><span class="line">		 */</span><br><span class="line">		const version = &#x27;3.7.4&#x27;;</span><br><span class="line">		/**</span><br><span class="line">		 * @deprecated use lowercase `version`.</span><br><span class="line">		 */</span><br><span class="line">		const VERSION = version;</span><br><span class="line">		const _hasatob = typeof atob === &#x27;function&#x27;;</span><br><span class="line">		const _hasbtoa = typeof btoa === &#x27;function&#x27;;</span><br><span class="line">		const _hasBuffer = typeof Buffer === &#x27;function&#x27;;</span><br><span class="line">		const _TD = typeof TextDecoder === &#x27;function&#x27; ? new TextDecoder() : undefined;</span><br><span class="line">		const _TE = typeof TextEncoder === &#x27;function&#x27; ? new TextEncoder() : undefined;</span><br><span class="line">		const b64ch = &#x27;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=&#x27;;</span><br><span class="line">		const b64chs = Array.prototype.slice.call(b64ch);</span><br><span class="line">		const b64tab = ((a) =&gt; &#123;</span><br><span class="line">			let tab = &#123;&#125;;</span><br><span class="line">			a.forEach((c, i) =&gt; tab[c] = i);</span><br><span class="line">			return tab;</span><br><span class="line">		&#125;)(b64chs);</span><br><span class="line">		const b64re = /^(?:[A-Za-z\d+\/]&#123;4&#125;)*?(?:[A-Za-z\d+\/]&#123;2&#125;(?:==)?|[A-Za-z\d+\/]&#123;3&#125;=?)?$/;</span><br><span class="line">		const _fromCC = String.fromCharCode.bind(String);</span><br><span class="line">		const _U8Afrom = typeof Uint8Array.from === &#x27;function&#x27; ?</span><br><span class="line">			Uint8Array.from.bind(Uint8Array) :</span><br><span class="line">			(it, fn = (x) =&gt; x) =&gt; new Uint8Array(Array.prototype.slice.call(it, 0).map(fn));</span><br><span class="line">		const _mkUriSafe = (src) =&gt; src</span><br><span class="line">			.replace(/=/g, &#x27;&#x27;).replace(/[+\/]/g, (m0) =&gt; m0 == &#x27;+&#x27; ? &#x27;-&#x27; : &#x27;_&#x27;);</span><br><span class="line">		const _tidyB64 = (s) =&gt; s.replace(/[^A-Za-z0-9\+\/]/g, &#x27;&#x27;);</span><br><span class="line">		/**</span><br><span class="line">		 * polyfill version of `btoa`</span><br><span class="line">		 */</span><br><span class="line">		const btoaPolyfill = (bin) =&gt; &#123;</span><br><span class="line">			// console.log(&#x27;polyfilled&#x27;);</span><br><span class="line">			let u32, c0, c1, c2, asc = &#x27;&#x27;;</span><br><span class="line">			const pad = bin.length % 3;</span><br><span class="line">			for (let i = 0; i &lt; bin.length;) &#123;</span><br><span class="line">				if ((c0 = bin.charCodeAt(i++)) &gt; 255 ||</span><br><span class="line">					(c1 = bin.charCodeAt(i++)) &gt; 255 ||</span><br><span class="line">					(c2 = bin.charCodeAt(i++)) &gt; 255)</span><br><span class="line">					throw new TypeError(&#x27;invalid character found&#x27;);</span><br><span class="line">				u32 = (c0 &lt;&lt; 16) | (c1 &lt;&lt; 8) | c2;</span><br><span class="line">				asc += b64chs[u32 &gt;&gt; 18 &amp; 63] +</span><br><span class="line">					b64chs[u32 &gt;&gt; 12 &amp; 63] +</span><br><span class="line">					b64chs[u32 &gt;&gt; 6 &amp; 63] +</span><br><span class="line">					b64chs[u32 &amp; 63];</span><br><span class="line">			&#125;</span><br><span class="line">			return pad ? asc.slice(0, pad - 3) + &quot;===&quot;.substring(pad) : asc;</span><br><span class="line">		&#125;;</span><br><span class="line">		/**</span><br><span class="line">		 * does what `window.btoa` of web browsers do.</span><br><span class="line">		 * @param &#123;String&#125; bin binary string</span><br><span class="line">		 * @returns &#123;string&#125; Base64-encoded string</span><br><span class="line">		 */</span><br><span class="line">		const _btoa = _hasbtoa ? (bin) =&gt; btoa(bin) :</span><br><span class="line">			_hasBuffer ? (bin) =&gt; Buffer.from(bin, &#x27;binary&#x27;).toString(&#x27;base64&#x27;) :</span><br><span class="line">			btoaPolyfill;</span><br><span class="line">		const _fromUint8Array = _hasBuffer ?</span><br><span class="line">			(u8a) =&gt; Buffer.from(u8a).toString(&#x27;base64&#x27;) :</span><br><span class="line">			(u8a) =&gt; &#123;</span><br><span class="line">				// cf. https://stackoverflow.com/questions/12710001/how-to-convert-uint8-array-to-base64-encoded-string/12713326#12713326</span><br><span class="line">				const maxargs = 0x1000;</span><br><span class="line">				let strs = [];</span><br><span class="line">				for (let i = 0, l = u8a.length; i &lt; l; i += maxargs) &#123;</span><br><span class="line">					strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs)));</span><br><span class="line">				&#125;</span><br><span class="line">				return _btoa(strs.join(&#x27;&#x27;));</span><br><span class="line">			&#125;;</span><br><span class="line">		/**</span><br><span class="line">		 * converts a Uint8Array to a Base64 string.</span><br><span class="line">		 * @param &#123;boolean&#125; [urlsafe] URL-and-filename-safe a la RFC4648 §5</span><br><span class="line">		 * @returns &#123;string&#125; Base64 string</span><br><span class="line">		 */</span><br><span class="line">		const fromUint8Array = (u8a, urlsafe = false) =&gt; urlsafe ? _mkUriSafe(_fromUint8Array(u8a)) :</span><br><span class="line">			_fromUint8Array(u8a);</span><br><span class="line">		// This trick is found broken https://github.com/dankogai/js-base64/issues/130</span><br><span class="line">		// const utob = (src: string) =&gt; unescape(encodeURIComponent(src));</span><br><span class="line">		// reverting good old fationed regexp</span><br><span class="line">		const cb_utob = (c) =&gt; &#123;</span><br><span class="line">			if (c.length &lt; 2) &#123;</span><br><span class="line">				var cc = c.charCodeAt(0);</span><br><span class="line">				return cc &lt; 0x80 ? c :</span><br><span class="line">					cc &lt; 0x800 ? (_fromCC(0xc0 | (cc &gt;&gt;&gt; 6)) +</span><br><span class="line">						_fromCC(0x80 | (cc &amp; 0x3f))) :</span><br><span class="line">					(_fromCC(0xe0 | ((cc &gt;&gt;&gt; 12) &amp; 0x0f)) +</span><br><span class="line">						_fromCC(0x80 | ((cc &gt;&gt;&gt; 6) &amp; 0x3f)) +</span><br><span class="line">						_fromCC(0x80 | (cc &amp; 0x3f)));</span><br><span class="line">			&#125; else &#123;</span><br><span class="line">				var cc = 0x10000 +</span><br><span class="line">					(c.charCodeAt(0) - 0xD800) * 0x400 +</span><br><span class="line">					(c.charCodeAt(1) - 0xDC00);</span><br><span class="line">				return (_fromCC(0xf0 | ((cc &gt;&gt;&gt; 18) &amp; 0x07)) +</span><br><span class="line">					_fromCC(0x80 | ((cc &gt;&gt;&gt; 12) &amp; 0x3f)) +</span><br><span class="line">					_fromCC(0x80 | ((cc &gt;&gt;&gt; 6) &amp; 0x3f)) +</span><br><span class="line">					_fromCC(0x80 | (cc &amp; 0x3f)));</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;;</span><br><span class="line">		const re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;</span><br><span class="line">		/**</span><br><span class="line">		 * @deprecated should have been internal use only.</span><br><span class="line">		 * @param &#123;string&#125; src UTF-8 string</span><br><span class="line">		 * @returns &#123;string&#125; UTF-16 string</span><br><span class="line">		 */</span><br><span class="line">		const utob = (u) =&gt; u.replace(re_utob, cb_utob);</span><br><span class="line">		//</span><br><span class="line">		const _encode = _hasBuffer ?</span><br><span class="line">			(s) =&gt; Buffer.from(s, &#x27;utf8&#x27;).toString(&#x27;base64&#x27;) :</span><br><span class="line">			_TE ?</span><br><span class="line">			(s) =&gt; _fromUint8Array(_TE.encode(s)) :</span><br><span class="line">			(s) =&gt; _btoa(utob(s));</span><br><span class="line">		/**</span><br><span class="line">		 * converts a UTF-8-encoded string to a Base64 string.</span><br><span class="line">		 * @param &#123;boolean&#125; [urlsafe] if `true` make the result URL-safe</span><br><span class="line">		 * @returns &#123;string&#125; Base64 string</span><br><span class="line">		 */</span><br><span class="line">		const encode = (src, urlsafe = false) =&gt; urlsafe ?</span><br><span class="line">			_mkUriSafe(_encode(src)) :</span><br><span class="line">			_encode(src);</span><br><span class="line">		/**</span><br><span class="line">		 * converts a UTF-8-encoded string to URL-safe Base64 RFC4648 §5.</span><br><span class="line">		 * @returns &#123;string&#125; Base64 string</span><br><span class="line">		 */</span><br><span class="line">		const encodeURI = (src) =&gt; encode(src, true);</span><br><span class="line">		// This trick is found broken https://github.com/dankogai/js-base64/issues/130</span><br><span class="line">		// const btou = (src: string) =&gt; decodeURIComponent(escape(src));</span><br><span class="line">		// reverting good old fationed regexp</span><br><span class="line">		const re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]&#123;2&#125;|[\xF0-\xF7][\x80-\xBF]&#123;3&#125;/g;</span><br><span class="line">		const cb_btou = (cccc) =&gt; &#123;</span><br><span class="line">			switch (cccc.length) &#123;</span><br><span class="line">				case 4:</span><br><span class="line">					var cp = ((0x07 &amp; cccc.charCodeAt(0)) &lt;&lt; 18) |</span><br><span class="line">						((0x3f &amp; cccc.charCodeAt(1)) &lt;&lt; 12) |</span><br><span class="line">						((0x3f &amp; cccc.charCodeAt(2)) &lt;&lt; 6) |</span><br><span class="line">						(0x3f &amp; cccc.charCodeAt(3)),</span><br><span class="line">						offset = cp - 0x10000;</span><br><span class="line">					return (_fromCC((offset &gt;&gt;&gt; 10) + 0xD800) +</span><br><span class="line">						_fromCC((offset &amp; 0x3FF) + 0xDC00));</span><br><span class="line">				case 3:</span><br><span class="line">					return _fromCC(((0x0f &amp; cccc.charCodeAt(0)) &lt;&lt; 12) |</span><br><span class="line">						((0x3f &amp; cccc.charCodeAt(1)) &lt;&lt; 6) |</span><br><span class="line">						(0x3f &amp; cccc.charCodeAt(2)));</span><br><span class="line">				default:</span><br><span class="line">					return _fromCC(((0x1f &amp; cccc.charCodeAt(0)) &lt;&lt; 6) |</span><br><span class="line">						(0x3f &amp; cccc.charCodeAt(1)));</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;;</span><br><span class="line">		/**</span><br><span class="line">		 * @deprecated should have been internal use only.</span><br><span class="line">		 * @param &#123;string&#125; src UTF-16 string</span><br><span class="line">		 * @returns &#123;string&#125; UTF-8 string</span><br><span class="line">		 */</span><br><span class="line">		const btou = (b) =&gt; b.replace(re_btou, cb_btou);</span><br><span class="line">		/**</span><br><span class="line">		 * polyfill version of `atob`</span><br><span class="line">		 */</span><br><span class="line">		const atobPolyfill = (asc) =&gt; &#123;</span><br><span class="line">			// console.log(&#x27;polyfilled&#x27;);</span><br><span class="line">			asc = asc.replace(/\s+/g, &#x27;&#x27;);</span><br><span class="line">			if (!b64re.test(asc))</span><br><span class="line">				throw new TypeError(&#x27;malformed base64.&#x27;);</span><br><span class="line">			asc += &#x27;==&#x27;.slice(2 - (asc.length &amp; 3));</span><br><span class="line">			let u24, bin = &#x27;&#x27;,</span><br><span class="line">				r1, r2;</span><br><span class="line">			for (let i = 0; i &lt; asc.length;) &#123;</span><br><span class="line">				u24 = b64tab[asc.charAt(i++)] &lt;&lt; 18 |</span><br><span class="line">					b64tab[asc.charAt(i++)] &lt;&lt; 12 |</span><br><span class="line">					(r1 = b64tab[asc.charAt(i++)]) &lt;&lt; 6 |</span><br><span class="line">					(r2 = b64tab[asc.charAt(i++)]);</span><br><span class="line">				bin += r1 === 64 ? _fromCC(u24 &gt;&gt; 16 &amp; 255) :</span><br><span class="line">					r2 === 64 ? _fromCC(u24 &gt;&gt; 16 &amp; 255, u24 &gt;&gt; 8 &amp; 255) :</span><br><span class="line">					_fromCC(u24 &gt;&gt; 16 &amp; 255, u24 &gt;&gt; 8 &amp; 255, u24 &amp; 255);</span><br><span class="line">			&#125;</span><br><span class="line">			return bin;</span><br><span class="line">		&#125;;</span><br><span class="line">		/**</span><br><span class="line">		 * does what `window.atob` of web browsers do.</span><br><span class="line">		 * @param &#123;String&#125; asc Base64-encoded string</span><br><span class="line">		 * @returns &#123;string&#125; binary string</span><br><span class="line">		 */</span><br><span class="line">		const _atob = _hasatob ? (asc) =&gt; atob(_tidyB64(asc)) :</span><br><span class="line">			_hasBuffer ? (asc) =&gt; Buffer.from(asc, &#x27;base64&#x27;).toString(&#x27;binary&#x27;) :</span><br><span class="line">			atobPolyfill;</span><br><span class="line">		//</span><br><span class="line">		const _toUint8Array = _hasBuffer ?</span><br><span class="line">			(a) =&gt; _U8Afrom(Buffer.from(a, &#x27;base64&#x27;)) :</span><br><span class="line">			(a) =&gt; _U8Afrom(_atob(a), c =&gt; c.charCodeAt(0));</span><br><span class="line">		/**</span><br><span class="line">		 * converts a Base64 string to a Uint8Array.</span><br><span class="line">		 */</span><br><span class="line">		const toUint8Array = (a) =&gt; _toUint8Array(_unURI(a));</span><br><span class="line">		//</span><br><span class="line">		const _decode = _hasBuffer ?</span><br><span class="line">			(a) =&gt; Buffer.from(a, &#x27;base64&#x27;).toString(&#x27;utf8&#x27;) :</span><br><span class="line">			_TD ?</span><br><span class="line">			(a) =&gt; _TD.decode(_toUint8Array(a)) :</span><br><span class="line">			(a) =&gt; btou(_atob(a));</span><br><span class="line">		const _unURI = (a) =&gt; _tidyB64(a.replace(/[-_]/g, (m0) =&gt; m0 == &#x27;-&#x27; ? &#x27;+&#x27; : &#x27;/&#x27;));</span><br><span class="line">		/**</span><br><span class="line">		 * converts a Base64 string to a UTF-8 string.</span><br><span class="line">		 * @param &#123;String&#125; src Base64 string.  Both normal and URL-safe are supported</span><br><span class="line">		 * @returns &#123;string&#125; UTF-8 string</span><br><span class="line">		 */</span><br><span class="line">		const decode = (src) =&gt; _decode(_unURI(src));</span><br><span class="line">		/**</span><br><span class="line">		 * check if a value is a valid Base64 string</span><br><span class="line">		 * @param &#123;String&#125; src a value to check</span><br><span class="line">		 */</span><br><span class="line">		const isValid = (src) =&gt; &#123;</span><br><span class="line">			if (typeof src !== &#x27;string&#x27;)</span><br><span class="line">				return false;</span><br><span class="line">			const s = src.replace(/\s+/g, &#x27;&#x27;).replace(/=&#123;0,2&#125;$/, &#x27;&#x27;);</span><br><span class="line">			return !/[^\s0-9a-zA-Z\+/]/.test(s) || !/[^\s0-9a-zA-Z\-_]/.test(s);</span><br><span class="line">		&#125;;</span><br><span class="line">		//</span><br><span class="line">		const _noEnum = (v) =&gt; &#123;</span><br><span class="line">			return &#123;</span><br><span class="line">				value: v,</span><br><span class="line">				enumerable: false,</span><br><span class="line">				writable: true,</span><br><span class="line">				configurable: true</span><br><span class="line">			&#125;;</span><br><span class="line">		&#125;;</span><br><span class="line">		/**</span><br><span class="line">		 * extend String.prototype with relevant methods</span><br><span class="line">		 */</span><br><span class="line">		const extendString = function() &#123;</span><br><span class="line">			const _add = (name, body) =&gt; Object.defineProperty(String.prototype, name, _noEnum(body));</span><br><span class="line">			_add(&#x27;fromBase64&#x27;, function() &#123;</span><br><span class="line">				return decode(this);</span><br><span class="line">			&#125;);</span><br><span class="line">			_add(&#x27;toBase64&#x27;, function(urlsafe) &#123;</span><br><span class="line">				return encode(this, urlsafe);</span><br><span class="line">			&#125;);</span><br><span class="line">			_add(&#x27;toBase64URI&#x27;, function() &#123;</span><br><span class="line">				return encode(this, true);</span><br><span class="line">			&#125;);</span><br><span class="line">			_add(&#x27;toBase64URL&#x27;, function() &#123;</span><br><span class="line">				return encode(this, true);</span><br><span class="line">			&#125;);</span><br><span class="line">			_add(&#x27;toUint8Array&#x27;, function() &#123;</span><br><span class="line">				return toUint8Array(this);</span><br><span class="line">			&#125;);</span><br><span class="line">		&#125;;</span><br><span class="line">		/**</span><br><span class="line">		 * extend Uint8Array.prototype with relevant methods</span><br><span class="line">		 */</span><br><span class="line">		const extendUint8Array = function() &#123;</span><br><span class="line">			const _add = (name, body) =&gt; Object.defineProperty(Uint8Array.prototype, name, _noEnum(body));</span><br><span class="line">			_add(&#x27;toBase64&#x27;, function(urlsafe) &#123;</span><br><span class="line">				return fromUint8Array(this, urlsafe);</span><br><span class="line">			&#125;);</span><br><span class="line">			_add(&#x27;toBase64URI&#x27;, function() &#123;</span><br><span class="line">				return fromUint8Array(this, true);</span><br><span class="line">			&#125;);</span><br><span class="line">			_add(&#x27;toBase64URL&#x27;, function() &#123;</span><br><span class="line">				return fromUint8Array(this, true);</span><br><span class="line">			&#125;);</span><br><span class="line">		&#125;;</span><br><span class="line">		/**</span><br><span class="line">		 * extend Builtin prototypes with relevant methods</span><br><span class="line">		 */</span><br><span class="line">		const extendBuiltins = () =&gt; &#123;</span><br><span class="line">			extendString();</span><br><span class="line">			extendUint8Array();</span><br><span class="line">		&#125;;</span><br><span class="line">		return &#123;</span><br><span class="line">			version: version,</span><br><span class="line">			VERSION: VERSION,</span><br><span class="line">			atob: _atob,</span><br><span class="line">			atobPolyfill: atobPolyfill,</span><br><span class="line">			btoa: _btoa,</span><br><span class="line">			btoaPolyfill: btoaPolyfill,</span><br><span class="line">			fromBase64: decode,</span><br><span class="line">			toBase64: encode,</span><br><span class="line">			encode: encode,</span><br><span class="line">			encodeURI: encodeURI,</span><br><span class="line">			encodeURL: encodeURI,</span><br><span class="line">			utob: utob,</span><br><span class="line">			btou: btou,</span><br><span class="line">			decode: decode,</span><br><span class="line">			isValid: isValid,</span><br><span class="line">			fromUint8Array: fromUint8Array,</span><br><span class="line">			toUint8Array: toUint8Array,</span><br><span class="line">			extendString: extendString,</span><br><span class="line">			extendUint8Array: extendUint8Array,</span><br><span class="line">			extendBuiltins: extendBuiltins,</span><br><span class="line">		&#125;;</span><br><span class="line">	&#125;</span><br><span class="line">	log(str) &#123;</span><br><span class="line">		console.log(`%c$&#123;str&#125;`, &quot;color:#333333;font-weight:blod;font-family:黑体;font-size:14px;&quot;)</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure>
</div>
        </div>
        
            <div class="kratos-copyright text-center clearfix">
                <h5 itemprop="copyrightNotice">本作品采用 <a rel="license nofollow" target="_blank" href="https://creativecommons.org/licenses/by-sa/4.0/">知识共享署名-相同方式共享 4.0 国际许可协议</a> 进行许可</h5>
            </div>
        
        <footer class="kratos-entry-footer clearfix">
            
                <div class="post-like-donate text-center clearfix" id="post-like-donate">
                
                
                    <a class="share" href="javascript:;"><i class="fa fa-share-alt"></i> 分享</a>
                    <div class="share-wrap" style="display: none;">
    <div class="share-group">
        <a href="javascript:;" class="share-plain qq" onclick="share('qq');" rel="nofollow">
            <div class="icon-wrap">
                <i class="fa fa-qq"></i>
            </div>
        </a>
        <a href="javascript:;" class="share-plain qzone" onclick="share('qzone');" rel="nofollow">
            <div class="icon-wrap">
                <i class="fa fa-star"></i>
            </div>
        </a>
        <a href="javascript:;" class="share-plain weixin pop style-plain" rel="nofollow">
            <div class="icon-wrap">
                <i class="fa fa-weixin"></i>
            </div>
            <div class="share-int">
                <div class="qrcode" id="wechat-qr"></div>
                <p>打开微信“扫一扫”，打开网页后点击屏幕右上角分享按钮</p>
            </div>
        </a>
        <a href="javascript:;" class="share-plain weibo" onclick="share('weibo');" rel="nofollow">
            <div class="icon-wrap">
                <i class="fa fa-weibo"></i>
            </div>
        </a>
        <a href="javascript:;" class="share-plain facebook style-plain" onclick="share('facebook');" rel="nofollow">
            <div class="icon-wrap">
                <i class="fa fa-facebook"></i>
            </div>
        </a>
        <a href="javascript:;" class="share-plain twitter style-plain" onclick="share('twitter');" rel="nofollow">
            <div class="icon-wrap">
                <i class="fa fa-twitter"></i>
            </div>
        </a>
    </div>
    <script type="text/javascript">
        $(()=>{
            new QRCode("wechat-qr", {
                text: "https://slsandxr.top/2023/02/07/js%E6%96%87%E4%BB%B6%E7%94%9F%E6%88%90%E5%92%8C%E8%A7%A3%E6%9E%90/",
                width: 150,
                height: 150,
                correctLevel : QRCode.CorrectLevel.H
            });
        });
        function share(dest) {
            const qqBase        = "https://connect.qq.com/widget/shareqq/index.html?";
            const weiboBase     = "https://service.weibo.com/share/share.php?";
            const qzoneBase     = "https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?";
            const facebookBase  = "https://www.facebook.com/sharer/sharer.php?";
            const twitterBase   = "https://twitter.com/intent/tweet?";
            const hostUrl       = "https://slsandxr.top/2023/02/07/js%E6%96%87%E4%BB%B6%E7%94%9F%E6%88%90%E5%92%8C%E8%A7%A3%E6%9E%90/";
            const title         = "「js文件生成和解析」";
            const excerpt       = `创建实例TEXT_FILE_TOOLS 如 new TEXT_FILE_TOOLS()会返回三个参数通过Promise将encodeFile和decodeFile



参数
介绍
传参



encodeFile
加密后生成文件，并...`;
            let _URL;
            switch (dest) {
                case "qq"       : _URL = qqBase+"url="+hostUrl+"&title="+title+"&desc=&summary="+excerpt+"&site=cxpy";     break;
                case "weibo"    : _URL = weiboBase+"url="+hostUrl+"&title="+title+excerpt;                                 break;
                case "qzone"    : _URL = qzoneBase+"url="+hostUrl+"&title="+title+"&desc=&summary="+excerpt+"&site=cxpy";  break;
                case "facebook" : _URL = facebookBase+"u="+hostUrl;                                                        break;
                case "twitter"  : _URL = twitterBase+"text="+title+excerpt+"&url="+hostUrl;                                break;
            }
            window.open(_URL);
        };
    </script>
</div>
                
                </div>
            
            <div class="footer-tag clearfix">
                <div class="pull-left">
                <i class="fa fa-tags"></i>
                    <a class="tag-none-link" href="/tags/%E5%89%8D%E7%AB%AF/" rel="tag">前端</a>
                </div>
                <div class="pull-date">
                    <time datetime="2024-12-16T11:07:04.239Z" itemprop="dateModified">最后编辑：2024-12-16</time>
                </div>
            </div>
        </footer>
    </div>
    
        <nav class="navigation post-navigation clearfix" role="navigation">
            
            <div class="nav-previous clearfix">
                <a title=" Nginx配置" href="/2023/01/04/nginx配置/">&lt; 上一篇</a>
            </div>
            
            
            <div class="nav-next clearfix">
                <a title=" 孙刘森的账本" href="/2023/02/10/孙刘森的账本/">下一篇 &gt;</a>
            </div>
            
        </nav>
    
    
</article>

        

            </section>

        

                
            

<section id="kratos-widget-area" class="col-md-4 hidden-xs hidden-sm">
    <!-- 文章和页面根据splitter来分割，没有的话就从头开始设置为sticky -->
    
    
                <aside id="krw-about" class="widget widget-kratos-about clearfix">
    <div class="photo-background"></div>
    <div class="photo-wrapper clearfix">
        <div class="photo-wrapper-tip text-center">
            <img class="about-photo" src="/images/avatar.webp" loading="lazy" decoding="auto" />
        </div>
    </div>
    <div class="textwidget">
        <p class="text-center">孙刘森的博客</p>
    </div>
    <div class="site-meta">
        <a class="meta-item" href="/archives/">
            <span class="title">
                文章
            </span>
            <span class="count">
                34
            </span>
        </a>
        <a class="meta-item" href="/categories/">
            <span class="title">
                分类
            </span>
            <span class="count">
                11
            </span>
        </a>
        <a class="meta-item" href="/tags/">
            <span class="title">
                标签
            </span>
            <span class="count">
                18
            </span>
        </a>
    </div>
</aside>
            
                    <div class="sticky-area">
                
                
  <aside id="krw-categories" class="widget widget-kratos-categories clearfix">
    <h4 class="widget-title"><i class="fa fa-folder"></i>分类目录</h4>
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/Js/">Js</a><span class="category-list-count">12</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/PETS-3/">PETS-3</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Tools/">Tools</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/UniCloud/">UniCloud</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E5%AD%99%E5%88%98%E6%A3%AE%E7%9A%84%E8%B4%A6%E6%9C%AC/">孙刘森的账本</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E5%AE%89%E5%8D%93/">安卓</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F/">微信小程序</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E6%88%91%E7%9A%84%E5%8D%9A%E5%AE%A2/">我的博客</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E6%8E%92%E5%BF%A7%E8%A7%A3%E9%9A%BE/">排忧解难</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E6%9C%8D%E5%8A%A1%E5%99%A8/">服务器</a><span class="category-list-count">12</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E7%A7%8D%E5%AD%90/">种子</a><span class="category-list-count">1</span></li></ul>
  </aside>


            
                
  <aside id="krw-tags" class="widget widget-kratos-tags clearfix">
    <h4 class="widget-title"><i class="fa fa-tags"></i>标签聚合</h4>
      <div class="tag-clouds">
        <a href="/tags/Docker/" style="font-size: 0.6em;">Docker</a> <a href="/tags/Java/" style="font-size: 0.6em;">Java</a> <a href="/tags/Linux/" style="font-size: 0.73em;">Linux</a> <a href="/tags/Mindway-js/" style="font-size: 0.6em;">Mindway.js</a> <a href="/tags/Mysql/" style="font-size: 0.6em;">Mysql</a> <a href="/tags/Nginx/" style="font-size: 0.67em;">Nginx</a> <a href="/tags/Node/" style="font-size: 0.6em;">Node</a> <a href="/tags/PETS-3/" style="font-size: 0.6em;">PETS-3</a> <a href="/tags/UniCloud/" style="font-size: 0.6em;">UniCloud</a> <a href="/tags/Vue3/" style="font-size: 0.6em;">Vue3</a> <a href="/tags/apk/" style="font-size: 0.6em;">apk</a> <a href="/tags/%E5%89%8D%E7%AB%AF/" style="font-size: 0.8em;">前端</a> <a href="/tags/%E5%89%8D%E7%AB%AF%E5%AD%98%E5%82%A8/" style="font-size: 0.6em;">前端存储</a> <a href="/tags/%E5%AD%99%E5%88%98%E6%A3%AE%E7%9A%84%E8%B4%A6%E6%9C%AC/" style="font-size: 0.6em;">孙刘森的账本</a> <a href="/tags/%E5%B7%A5%E5%85%B7/" style="font-size: 0.67em;">工具</a> <a href="/tags/%E6%8E%92%E5%BF%A7%E8%A7%A3%E9%9A%BE/" style="font-size: 0.6em;">排忧解难</a> <a href="/tags/%E7%A7%8D%E5%AD%90/" style="font-size: 0.6em;">种子</a> <a href="/tags/%E9%80%82%E9%85%8D/" style="font-size: 0.6em;">适配</a>
      </div>
  </aside>

            
                
  <aside id="krw-posts" class="widget widget-kratos-posts">
  <h4 class="widget-title"><i class="fa fa-file"></i>最新文章</h4>
  <div class="tab-content">
      <ul class="list-group">
        
        
          
          
            <a class="list-group-item" href="/2024/06/06/JS/%E9%80%82%E9%85%8D%E4%BB%A3%E7%A0%81/"><i class="fa  fa-book"></i> 前端rem适配代码</a>
            
          
        
          
          
            <a class="list-group-item" href="/2023/10/07/JS/canvas%E5%AE%9E%E7%8E%B0%E7%9B%96%E7%AB%A0/"><i class="fa  fa-book"></i> canvas实现盖章</a>
            
          
        
          
          
            <a class="list-group-item" href="/2023/08/31/JS/Js-sku%E5%95%86%E5%93%81%E8%A7%84%E5%88%99/"><i class="fa  fa-book"></i> Js-sku商品规则</a>
            
          
        
          
          
            <a class="list-group-item" href="/2023/07/28/%E6%8E%92%E5%BF%A7%E8%A7%A3%E9%9A%BE/"><i class="fa  fa-book"></i> 排忧解难</a>
            
          
        
          
          
            <a class="list-group-item" href="/2023/07/25/JS/Js%E5%AE%9E%E7%8E%B0%E8%A7%A3%E6%9E%90gif%E5%8A%A8%E5%9B%BE%E5%92%8C%E5%90%88%E6%88%90gif%E5%8A%A8%E5%9B%BE/"><i class="fa  fa-book"></i> Js实现解析gif动图和合成gif动图</a>
            
          
        
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
          
            
      </ul>
  </div>
  </aside>

            
    </div>
</section>
        
        </div>
    </div>
</div>
<footer>
    <div id="footer"  class="ap-lrc"  >
        <div class="container">
            <div class="row">
                <div class="col-md-6 col-md-offset-3 footer-list text-center">
                    <ul class="kratos-social-icons">
                        <!-- Keep for compatibility -->
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        <!-- New links -->
                        
                    </ul>
                    <ul class="kratos-copyright">
                        <div>
                            <li>&copy; 2024 Blog 版权所有.</li>
                            <li>本站已运行<span id="span_dt">Loading...</span></li>
                        </div>
                        <div>
                            <li>Theme <a href="https://github.com/Candinya/Kratos-Rebirth" target="_blank">Kratos:Rebirth</a></li>
                            <li>Site built with&nbsp;<i class="fa fa-heart throb" style="color:#d43f57"></i>&nbsp;by Sun Liusen.</li>
                        </div>
                        <div>
                            <li>Powered by <a href="https://hexo.io" target="_blank" rel="nofollow">Hexo</a></li>
                            <li>Hosted on <a href="https://github.io" target="_blank">Github Pages</a></li>
                        </div>
                        <div>
                            
                            
                        </div>
                    </ul>
                </div>
            </div>
        </div>
        <div class="kr-tool text-center">
            <div class="tool">
                
                    <div class="box search-box">
                        <a href="/search/">
                            <span class="fa fa-search"></span>
                        </a>
                    </div>
                
                
                    <div class="box theme-box" id="darkmode-switch">
                        <span class="fa fa-adjust"></span>
                    </div>
                
                
                
            </div>
            <div class="box gotop-box">
                <span class="fa fa-chevron-up"></span>
            </div>
        </div>
    </div>
</footer>
</div>
</div>

        <script defer src="/vendors/bootstrap@3.3.4/dist/js/bootstrap.min.js"></script>
<script defer src="/vendors/nprogress@0.2.0/nprogress.js"></script>
<script>
    if (!window.kr) {
        window.kr = {};
    }
    window.kr.notMobile = (!(navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)));
    window.kr.siteRoot = "/";
</script>


    <script async src="/js/candy.min.js"></script>



    <script defer src="/vendors/aplayer@1.10.1/dist/APlayer.min.js"></script>
    
    <script defer src="/vendors/meting@2.0.1/dist/Meting.min.js"></script>
    <meting-js
        server="netease"
        type="playlist"
        id="3204190542"
        order="random"
        fixed="true"
    >
    </meting-js>



    <script defer src="/vendors/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script>

<script defer src="/js/kratosr.min.js"></script>
<script defer src="/js/pjax.min.js"></script>



<!-- Extra support for third-party plguins  -->


    </body>
</html>